import request from '@/utils/request'

// 获取网络稳定性
export function getNetworkStability(deviceSN) {
  return request({
    url: '/business/modbus/network/stability/' + deviceSN,
    method: 'get'
  })
}

// 获取设备网络统计
export function getDeviceNetworkStats(deviceSN) {
  return request({
    url: '/business/modbus/network/stats/' + deviceSN,
    method: 'get'
  })
}

// 获取所有设备网络概览
export function getAllDevicesNetworkOverview() {
  return request({
    url: '/business/modbus/network/overview',
    method: 'get'
  })
}

// 获取网络质量
export function getNetworkQuality(deviceSN) {
  return request({
    url: '/business/modbus/network/quality/' + deviceSN,
    method: 'get'
  })
}

// 清除设备统计
export function clearDeviceStats(deviceSN) {
  return request({
    url: '/business/modbus/network/stats/' + deviceSN,
    method: 'delete'
  })
}

// 清除所有设备的监控数据
export function clearAllStats() {
  return request({
    url: '/business/modbus/network/stats',
    method: 'delete'
  })
}

// 获取网络监控配置信息
export function getMonitorConfig() {
  return request({
    url: '/business/modbus/network/config',
    method: 'get'
  })
}

// 手动记录连接尝试（用于测试）
export function recordConnectionAttempt(data) {
  return request({
    url: '/business/modbus/network/record',
    method: 'post',
    data: data
  })
}

// 批量获取设备统计
export function getBatchDeviceStats(deviceSNs) {
  return request({
    url: '/business/modbus/network/batch-stats',
    method: 'post',
    data: { deviceSNs: deviceSNs }
  })
}
